<template>
  <div class="page-pagination">
    <div class="game_cover">
      <div>
        <NuxtImg class="t" :src="gameInfo.icon" />
        <p>{{ gameInfo.title }}</p>
      </div>
    </div>
    <div class="game_operate">
      <div
        class="my_btn transparent heat_btn btn-item"
        style="overflow: hidden"
        @click="toPrev"
        v-click-move
      >
        <div class="transparent my_btn2"></div>
        <div class="info_font">
          <div class="info_font">
            <i class="el-icon"
              ><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
                <path
                  fill="currentColor"
                  d="M685.248 104.704a64 64 0 0 1 0 90.496L368.448 512l316.8 316.8a64 64 0 0 1-90.496 90.496L232.704 557.248a64 64 0 0 1 0-90.496l362.048-362.048a64 64 0 0 1 90.496 0z"
                ></path>
              </svg>
            </i>
          </div>
        </div>
      </div>
      <div
        class="my_btn transparent heat_btn btn-item"
        style="overflow: hidden"
        v-click-move
        @click="toNext"
      >
        <div class="transparent my_btn2"></div>
        <div class="info_font">
          <div class="info_font">
            <i class="el-icon"
              ><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
                <path
                  fill="currentColor"
                  d="M338.752 104.704a64 64 0 0 0 0 90.496l316.8 316.8-316.8 316.8a64 64 0 0 0 90.496 90.496l362.048-362.048a64 64 0 0 0 0-90.496L429.248 104.704a64 64 0 0 0-90.496 0z"
                ></path>
              </svg>
            </i>
          </div>
        </div>
      </div>
      <div
        class="my_btn transparent heat_btn btn-item btn_font"
        style="overflow: hidden"
        v-click-move
        @click="emits('changeGameType', props.gameInfo)"
      >
        <div class="transparent my_btn2"></div>
        <div class="info_font">
          <span>{{ lang.mais }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
const lang: any = getCurrentPageLang("home");

const props = defineProps({
  gameInfo: {
    type: Object,
    default: () => {},
  },
});

const emits: any = defineEmits(["changeGameType"]);

function toNext() {
  props.gameInfo.swiperRef?.next?.();
}

function toPrev() {
  props.gameInfo.swiperRef?.prev?.();
}
</script>

<style scoped lang="scss">
.page-pagination {
  margin-bottom: 0.15rem;
  display: flex;
  padding-bottom: 0;
  box-sizing: content-box;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0 0.3rem;
}

.page-pagination .game_cover {
  width: 100%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  font-size: 0.38rem;
  color: var(--theme-neutral1);

  div {
    margin-top: -0.1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .t {
    height: 0.65rem;
    margin-right: 0.3rem;
  }
}

.game_operate {
  display: flex;
  align-content: center;
  padding: 0.1rem 0;
  gap: 0.2rem;

  .btn-item {
    border-radius: 0.15rem;
    display: flex;
    justify-content: center;
    align-content: center;
    width: 0.7rem;
    height: 0.7rem;
    font-size: 0.4rem;
    color: var(--theme-neutral1);
    background-size: 100%;
    background-repeat: no-repeat;
    text-align: center;
    background-color: var(--box-bg-color);
  }

  .btn_font {
    width: 1rem;
    background: #ff69b4;
    font-weight: 400;
    span {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-size: 0.34rem;
    }
  }
}

// 合并所有重复的按钮样式
.transparent {
  background: transparent;
  color: var(--theme-neutral1);
}

.my_btn {
  cursor: pointer;
  display: inline-block;
  padding: 0.042rem 0.24rem;
  text-align: center;
  text-decoration: none;
  border-radius: 0.2rem;
  font-weight: 700;
  background-size: 0.2rem 0.2rem;
  position: relative;

  &:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  .my_btn2 {
    border-top-left-radius: 0.12rem;
    border-top-right-radius: 0.12rem;
    position: absolute;
    top: 6%;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
  }
}

.heat_btn {
  transition: all 0.3s ease-in-out;
  overflow: hidden;
}

@keyframes btn-move {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.15rem);
  }
  100% {
    transform: translateY(0);
  }
}

.btnMove {
  animation: btn-move 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.info_font {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-content: center;
  flex-direction: column;
  font-size: var(--font-size6);
}

.info_font {
  display: flex;
  justify-content: center;
  flex-direction: column !important;
  align-items: center;
}

.el-icon {
  --color: inherit;
  align-items: center;
  display: inline-flex;
  height: 1em;
  justify-content: center;
  line-height: 1em;
  position: relative;
  width: 1em;
  fill: currentColor;
  color: var(--color);
  font-size: inherit;

  svg {
    height: 1em;
    width: 1em;
  }
}
</style>
